package com.gzedu.module.faced.curd.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gzedu.module.faced.curd.CurdJsFacade;
import com.gzedu.module.modle.curd.CurdJs;
import com.gzedu.module.service.curd.ICurdJsService;

@Service
public class CurdJsFacadeImpl implements CurdJsFacade{

	@Autowired
	private ICurdJsService curdJsService;
	
	public int insertCurdJs(CurdJs curdJs) {
		// TODO Auto-generated method stub
		return curdJsService.insert(curdJs);
	}

	public List<CurdJs> selectByFormId(CurdJs curdJs) {
		// TODO Auto-generated method stub
		return curdJsService.selectByFormId(curdJs);
	}

	public List<CurdJs> selectByFormId(String curd_form_id) {
		// TODO Auto-generated method stub
		CurdJs curdJs = new CurdJs();
		curdJs.setCurd_form_id(curd_form_id);
		return curdJsService.selectByFormId(curdJs);
	}

	public String getJsContent(String curd_form_id) {
		// TODO Auto-generated method stub
		String jsContent = null;
		
		CurdJs curdJs = new CurdJs();
		curdJs.setCurd_form_id(curd_form_id);
		List<CurdJs> list = curdJsService.selectByFormId(curdJs);
		if(list != null && list.size() > 0){
			for(CurdJs js : list){
				jsContent = js.getJs_content();
			}
		}
		return jsContent;
	}

}
